#ifndef CVX_STROKE_H
#define CVX_STROKE_H 1

//get geometry property of a stroke in a image

#include "cvxImage.h"
#include "cvxQuadTree.h"

class CvxQuadTree;

/************************************************************************/
/* 
		CvxStroke
*/
/************************************************************************/
class CvxStroke
{
public:
	CvxStroke(int w, int h);
	virtual ~CvxStroke();

	virtual bool SetStroke(const vector<cv::Point> &pathPts, int penWidth, int &curIdx);
	//blender stroke area with a color
	virtual bool BlenderStroke(const vector<cv::Point> &pathPts, int penWidth, Mat &showImage);

	virtual void updateIdx();

	virtual void testShowMap();

	

public:
	Mat m_map;             //stroke map
	int m_curIdx;          //current index
//	cv::Rect m_curRect;    //current rect area
};

/************************************************************************/
/* 
		CvxQuadStroke
*/
/************************************************************************/

class CvxQuadStroke:public CvxStroke
{
public:
	CvxQuadStroke(int w, int h, CvxQuadTree *pTree);
	~CvxQuadStroke();

	//set stroke pixel in the quad tree
	bool SetStroke(const vector<cv::Point> &pathPts, int penWidth, int &curIdx);
	bool updateNode(int x, int y, cv::Rect &rect);   //update node set statement in position x, y
	void updateIdx();
	bool isSetIdx(int x, int y);    //is (y, x) be set?

	void testShowMap();
private:
	CvxQuadTree *m_pTree;       //point to a quad tree.
public:
	Mat m_quadMap;
};


#endif
